import com.feriki.msync.config.ComplexConnectConfig;
import com.feriki.msync.pool.MilvusConnectionPool;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.R;
import io.milvus.param.RpcStatus;
import io.milvus.param.index.DropIndexParam;

/**
 * @author luozhida
 * @create 2024-08-06
 */
public class DropIndexClient {
    public static void main(String[] args) {
        ComplexConnectConfig milvusConfig = new ComplexConnectConfig();
        milvusConfig.setHost("10.210.60.218");
        milvusConfig.setPort(19530);
        milvusConfig.setUser("root");
        milvusConfig.setPassword("Milvus");
        MilvusConnectionPool milvusConnectionPool = new MilvusConnectionPool("search-pool", milvusConfig, 1);
        MilvusServiceClient milvusServiceClient1 = null;
        try {
            milvusServiceClient1 = milvusConnectionPool.getConnection();
            R<RpcStatus> resultsR = milvusServiceClient1.dropIndex(DropIndexParam.newBuilder()
                    .withCollectionName("xxxxx")
                    .withIndexName("ie").build());
            System.out.println(resultsR);
        } catch (InterruptedException e) {

        }finally {
            if(milvusServiceClient1!=null){
                milvusConnectionPool.releaseConnection(milvusServiceClient1);
            }
        }
    }
}
